﻿<navigation:Page x:Class="ProTemplate.Views.Varify" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
           xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
           xmlns:myRowSelectors="clr-namespace:ProTemplate.Utility.Selectors"
           xmlns:sys="clr-namespace:System;assembly=mscorlib"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="校验工具">
    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <Style x:Key="RedRowStyle" TargetType="telerik:GridViewRow">
                <Setter Property="Foreground" Value="Red" />
            </Style>
            <Style x:Key="GreenRowStyle" TargetType="telerik:GridViewRow">
                <Setter Property="Foreground" Value="Green" />
            </Style>
            <Style x:Key="DefaultRowStyle" TargetType="telerik:GridViewRow"/>

            <myRowSelectors:ConditionalStyleSelector x:Key="selector" ConditionConverter="{StaticResource DoubleCheckDeclarationVarifyStatueConverter}">
                <myRowSelectors:ConditionalStyleSelector.Rules>
                    <myRowSelectors:ConditionalStyleRule Style="{StaticResource DefaultRowStyle}">
                        <myRowSelectors:ConditionalStyleRule.Value>
                            <sys:Int32>0</sys:Int32>
                        </myRowSelectors:ConditionalStyleRule.Value>
                    </myRowSelectors:ConditionalStyleRule>
                    <myRowSelectors:ConditionalStyleRule Style="{StaticResource RedRowStyle}">
                        <myRowSelectors:ConditionalStyleRule.Value>
                            <sys:Int32>1</sys:Int32>
                        </myRowSelectors:ConditionalStyleRule.Value>
                    </myRowSelectors:ConditionalStyleRule>
                    <myRowSelectors:ConditionalStyleRule Style="{StaticResource GreenRowStyle}">
                        <myRowSelectors:ConditionalStyleRule.Value>
                            <sys:Int32>2</sys:Int32>
                        </myRowSelectors:ConditionalStyleRule.Value>
                    </myRowSelectors:ConditionalStyleRule>
                </myRowSelectors:ConditionalStyleSelector.Rules>
            </myRowSelectors:ConditionalStyleSelector>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Height="30">
            <TextBlock Text="18位海关编号:" VerticalAlignment="Center" />
            <TextBox x:Name="tbNumber" Width="150" Margin="0,3" TextChanged="tbNumber_TextChanged" />
            <!--<TextBlock Text="9位核销单号:" VerticalAlignment="Center" Margin="15,0,0,0" />
            <TextBox x:Name="tbApproveNumber" Width="150" Margin="0,3" TextChanged="tbApproveNumber_TextChanged" />-->
            <Button x:Name="btnVarify" Margin="10,3" Width="100" Content="开始校验" Click="btnVarify_Click" />
            <Button x:Name="btnClear" Margin="10,3" Width="100" Content="清除" Click="btnClear_Click" />
            <TextBlock Text="打单机器：" VerticalAlignment="Center" Margin="15,0,0,0"  />
            <ComboBox x:Name="cbMachines" Width="92" VerticalAlignment="Center" Height="25" ItemsSource="{Binding Items, Source={StaticResource MachineViewModel}}" DisplayMemberPath="MachineName" />
        </StackPanel>
        <telerikGridView:RadGridView telerik:Theming.Theme="Office_Blue" x:Name="gdBoss" Grid.Row="1" Style="{StaticResource CommonRadGridView}" 
                                     ItemsSource="{Binding Path=Items, Source={StaticResource DoubleCheckDeclarationVarifyViewModel}}" ShowGroupPanel="False"
                                     RowStyleSelector="{StaticResource selector}">
            <telerikGridView:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="序号" DataMemberBinding="{Binding Index}" IsFilterable="False" />
                <telerik:GridViewDataColumn Header="客户名称" DataMemberBinding="{Binding CustomerName}" />
                <telerik:GridViewDataColumn Header="海关编号" DataMemberBinding="{Binding DeclarationNumber}" />
                <telerik:GridViewDataColumn Header="核销单号" DataMemberBinding="{Binding ApprovalNumber}" />
                <telerik:GridViewDataColumn Header="成交方式" DataMemberBinding="{Binding TransactionName}" />
                <telerik:GridViewDataColumn Header="校验状态" DataMemberBinding="{Binding VarifyFlag}" IsFilterable="False" />
                <telerik:GridViewDataColumn Header="校验信息" DataMemberBinding="{Binding VarifyMsg}" IsFilterable="False" />
            </telerikGridView:RadGridView.Columns>
        </telerikGridView:RadGridView>
    </Grid>
</navigation:Page>
